<template>
	<view class="registerlist">
		<view class="register">
			<LoadMore ref="LoadMore" id="LoadMore" :diffHeight="30" :initData="initData" @dataRefresh='dataRefresh'>
				<text></text>
				<view class="register_list" v-for="(item,index) in list" :key="index" @click="Onpayinfo(item)">
					<view class="register_image">
						<image v-if="!item.status_is" src="../../static/my/gh_b.png"></image>
						<image v-else src="../../static/my/gh_a.png"></image>
					</view>
					<view class="register_box">
						<view class="font-323232 font15 font-b">
							{{item.typename}}
						</view>
						<view class="font-9c9c9d font13">就诊人:{{item.user_the_patient_info.name}}</view>
						<view class="font-9c9c9d font13">{{item.room_name}}</view>
						<view class="font-9c9c9d font13">{{item.doctor_name}}/{{item.academic_title_name}}</view>
					</view>
					<view class="register_time">
						<view class="font-323232 font15 font-b">就诊时间</view>
						<view class="font-9c9c9d font13">
							{{item.time}}
							<text>{{item.begin_time}}~{{item.end_time}}</text>
						</view>

					</view>
				</view>
			</LoadMore>
		</view>
	</view>
</template>

<script>
	import LoadMore from "@/components/loadMore.vue";
	export default {
		components: {
			LoadMore
		},
		data() {
			return {
				//传参数据
				initData: {
					url: 'listHangNumberOrder', //接口
					//data里得传参
					param: {},
				},
				list: []
			}
		},
		methods: {
			//返回数据
			dataRefresh(e) {
				e.forEach(item => {
					item.createtime = this.$base.formatTime(new Date(item.createtime *
						1000), "yyyy/MM/dd hh:mm:ss")
					if (item.pay_status == 2) {
						if (item.status == 'normal') {
							item.typename = '待支付'
						}
						if (item.status == 'cancel') {
							item.typename = '已取消'
						}
						item.status_is = false
					}
					if (item.pay_status == 1) {
						item.status_is = true
						if (item.status == 'refund') {
							item.typename = '已退款'
							item.status_is = false
						}
						if (item.status == 'normal') {
							item.typename = '挂号成功'
						}
					}
				})
				this.list = e
			},
			//查看详情
			Onpayinfo(e) {
				if (e.pay_status == 2) {
					uni.navigateTo({
						url: '/pagesA/register/conpay?id=' + e.order_code,
					})
				}
				if (e.pay_status == 1) {
					uni.navigateTo({
						url: '/pagesA/register/payinfo?id=' + e.order_code,
					})
				}

			}
		}
	}
</script>

<style>
	.registerlist {
		background-color: #f9f9f9;
		height: 100%;
		padding-top: 30rpx;
	}

	.register_list {
		width: 750rpx;
		padding: 25rpx;
		margin-bottom: 20rpx;
		background-color: #ffffff;
		display: flex;
		align-items: center;
	}

	.register_image image {
		width: 60rpx;
		height: 60rpx;
	}

	.register_box {
		width: 290rpx;
		padding-left: 25rpx;
	}

	.register_box view:nth-of-type(2) {
		margin: 10rpx 0;
	}

	.register_box view:nth-of-type(3) {
		margin-bottom: 10rpx;
	}

	.register_time {
		width: 350rpx;
		text-align: right;
	}

	.register_time view:nth-of-type(1) {
		margin-bottom: 10rpx;
	}

	.register_time text {
		margin-left: 10rpx;
	}
</style>
